<?php

use Phinx\Migration\AbstractMigration;

class Currency extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('currency', array('comment' => '汇率表'));
        $table->addColumn('from_currency', 'string', array('limit' => 10, 'comment' => '要转换的币种'))
            ->addColumn('to_currency', 'string', array('limit' => 10, 'comment' => '转换的币种'))
            ->addColumn('date', 'date', array('comment' => '汇率更新日期'))
            ->addColumn('time', 'time', array('comment' => '汇率更新时间'))
            ->addColumn('currency', 'decimal', array('scale' => 11, 'precision' => 12, 'comment' => '汇率'))
            ->addColumn('created_at', 'timestamp', array('null' => true))
            ->addColumn('updated_at', 'timestamp', array('null' => true))
            ->save();     
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $this->dropTable('currency');
    }
}
